<template>
	<view class="commission_record_container">
		<view class="my_commission_box">
			<!-- 当前佣金 -->
			<view class="commission_box" v-for="item in commissionList" :key="item.id" @click="handlerCommission(item)">
				<view class="commission_title">
					{{ item.title }}
				</view>
				<view class="commission_price" v-if="item.id == '0'">
					<span style="font-size: 20rpx;">￥</span>{{ personMsgObj.yj }}
				</view>
				<!-- {{ personMsgObj.al_yj }} -->
				<view class="commission_price" v-if="item.id == '1'">
					<span style="font-size: 20rpx;">￥</span>{{userAccumulated}}
				</view>
				<view class="commission_price" v-if="item.id == '2'">
					<span style="font-size: 20rpx;">￥</span>{{ personMsgObj.yj }}
				</view>
				<view class="commission_btn">
					{{ item.tip }} >
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['personMsgObj', 'userAccumulated'],
		data() {
			return {
				commissionList: [{
						id: '0',
						title: '当前佣金',
						price: '',
						tip: '佣金记录'
					},
					{
						id: '1',
						title: '累计提现',
						price: '',
						tip: '提现记录'
					},
					{
						id: '2',
						title: '可提现',
						price: '',
						tip: '申请提现'
					},
				]
			}
		},
		methods: {
			// 判断用户是否实名认证接口
			checkRealName() {
				this.$request("/api/checkRealName", {}, "POST").then((res) => {
			
					if (res.code == 1) {
						if (res.data == 0) {
							// 未实名
							uni.navigateTo({
								url: "/pages/my/withdrawal/noRealName",
							});
						} else {
							// 已实名
							uni.navigateTo({
								url: "/pages/my/withdrawal/withdrawal",
							});
						}
					} else {
						uni.showToast({
							title: "是否实名查询失败",
							icon: "none",
						});
						return;
					}
				});
			},

			// 点击佣金记录
			handlerCommission(val) {
				if (val.title == '当前佣金') {
					uni.navigateTo({
						url: '/pages/my/kickbackRecord/kickbackRecord'
					})
				} else if (val.title == '累计提现') {
					uni.navigateTo({
						url: '/pages/my/accWithdrawal/accWithdrawal'
					})
				} else if (val.title == '可提现') {
					if (this.isShowWithdrawalNew == false) {
						return;
					} else {
						this.checkRealName();
						// uni.navigateTo({
						// 	url: '/pages/my/withdrawal/withdrawal'
						// })
					}
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.commission_record_container {

		.my_commission_box {
			display: flex;
			justify-content: space-between;
			background: #FFFFFF;
			box-shadow: 0px 5rpx 17rpx 1px rgba(172, 168, 168, 0.15);
			border-radius: 10rpx;
			margin: 0 18rpx;

			.commission_box {
				display: flex;
				flex-direction: column;
				align-items: flex-start;
				padding: 20rpx 19rpx;

				.commission_title {
					font-family: Source Han Sans CN;
					font-weight: 400;
					font-size: 24rpx;
					color: #808080;
				}

				.commission_price {
					font-family: my-font;
					font-weight: 500;
					font-size: 30rpx;
					color: #333333;
					padding: 12rpx 0 10rpx;
				}

				.commission_btn {
					background: #FF6060;
					border-radius: 50rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					font-size: 19rpx;
					color: #FFFFFF;
					padding: 3rpx 4rpx;
				}
			}
		}
	}
</style>